// components/like/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    // 对外暴露的属性
    count: {
      type:Number
    },
    like: {
      type:Boolean
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    likeSrc:'images/like.png',
    noLikeSrc: 'images/like@dis.png'
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onLike:function(){
      let like = this.properties.like
      let count = this.properties.count
      count = like ? --count : ++count
      like = !like
      this.setData({
        like:like,
        count:count
      })
      this.triggerEvent('onLike', {
        like: this.properties.like
      })
    }
  }
})
